// pages/mine/components/list/minelist.js
let app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  options: {
    addGlobalClass: true,
  },
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    listData: {
      listConfig: {
        isShowIcon: true,
      },
      listData: [{
          icon: 'icon-recycle',
          name: '回收站',
          url: '/pages/mine/pages/recycle/recycle'
        },
        {
          icon: 'icon-set',
          name: '账号信息',
          url: '/pages/mine/pages/userinfo/userinfo'
        },
        {
          icon: 'icon-download',
          name: '下载位置',
          showFrame: true
        },
        {
          icon: 'icon-aboutus',
          name: '关于我们',
          url: '/pages/mine/pages/about/about'
        },
        {
          icon: 'icon-nightmode',
          name: '夜间模式',
          switch: true,
          url: '/pages/mine/mine'

        },
        {
          icon: 'icon-help',
          name: '帮助与反馈',
          url: '/pages/mine/pages/help/help'
        },
        {
          icon: 'icon-sponsor',
          name: '赞助与支持',
          url: '/pages/mine/pages/sponsor/sponsor'
        }
      ]
    },
    isNightMode: wx.getStorageSync('isNightMode'),
  },
  /**
   * 组件的方法列表
   */
  methods: {
    bindchange(e) {
      this.setData({
        isNightMode: e.detail.value
      })
      wx.setStorageSync('isNightMode', e.detail.value)
      this.triggerEvent('isNightMode', e.detail.value)
    },
    goNavigator(e) {
      if (!e.currentTarget.dataset.showdownload) {
        wx.navigateTo({
          url: e.currentTarget.dataset.url
        })
      } else {
        this.triggerEvent('showdownload', e.currentTarget.dataset.showdownload)
      }
    }
  }
})